package com.lin.mybatis.interceptor;

import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;

import java.util.Arrays;
import java.util.List;

/**
 * @author linjiang
 * @date 2024/7/6
 * @fn
 */
public class TenantHandler implements TenantLineHandler {

    List<String> tables = Arrays.asList();

    @Override
    public Expression getTenantId() {
        return new StringValue("10");
    }

    @Override
    public String getTenantIdColumn() {
        return "tenant_id";
    }

    @Override
    public boolean ignoreTable(String tableName) {
        return tables.stream().anyMatch(var -> var.equalsIgnoreCase(tableName));
    }

}
